using Godot;
using System;

public partial class EnemyPursueArea : Area2D
{
	// Called when the node enters the scene tree for the first time.
	private Enemy _root;
	public override void _Ready()
	{
		BodyShapeEntered += OnCollisonEnemyPursue;
		BodyShapeExited += OnCollisionEnemyPursueEnd;
		_root = GetParent<Enemy>();


	}

	private void OnCollisionEnemyPursueEnd(Rid bodyRid, Node2D body, long bodyShapeIndex, long localShapeIndex)
	{

		_root.isPursue = false;
		_root._heroBody = null;
	}


	private void OnCollisonEnemyPursue(Rid bodyRid, Node2D body, long bodyShapeIndex, long localShapeIndex)
	{
		GD.Print("巡逻区域碰撞", body.Name, bodyShapeIndex, localShapeIndex);
		_root.isPursue = true;
		_root._heroBody = body.GetParent<Hero>();
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
	}
}
